{% extends "nomcom/nomcom_public_base.html" %}
{# Copyright The IETF Trust 2015, All Rights Reserved #}
{% load origin textfilters ietf_filters %}
{% block subtitle %}- Questionnaires{% endblock %}
{% block nomcom_content %}
    {% origin %}
    <h2>Questionnaires</h2>
    <ul class="nomcom-questnr-positions-tabs nav nav-tabs my-3" role="tablist">
        {% for position in positions %}
            <li class="nav-item" role="presentation">
                <button class="nav-link {% if forloop.first %}active{% endif %}"
                        data-bs-toggle="tab"
                        role="tab" type="button"
                        data-bs-target="#{{ position.name|slugify }}">
                    {{ position.name }}
                </button>
            </li>
        {% endfor %}
    </ul>
    <div class="nomcom-questnr-positions-content tab-content">
        {% for position in positions %}
            <div role="tabpanel" class="tab-pane {% if forloop.first %} active{% endif %}"
                 id="{{ position.name|slugify }}">
                {{ position.get_questionnaire|urlize_ietf_docs|linkify|linebreaks }}
            </div>
        {% endfor %}
    </div>
{% endblock %}
{% block js %}
    <script>
        $(document)
            .ready(function () {
                // Javascript to enable link to tab
                var url = document.location.toString();
                if (url.match('#')) {
                    $('.nav-tabs button[data-bs-target="#' + url.split('#')[1] + '"]')
                        .tab('show');
                }
                // Change hash for page-reload
                $('.nav-tabs button')
                    .on('shown.bs.tab', function (e) {
                        history.replaceState(null, null, e.currentTarget.dataset.bsTarget);
                    });
            });
    </script>
{% endblock %}